import org.junit.Ignore
import org.junit.Test
import kotlin.jvm.internal.Ref
import kotlin.test.assertEquals

class SwapIntTest {

    fun some(i1: () -> Int, i2: () -> Int) {
        val f1 = i1.javaClass.getDeclaredField("\$i1").apply { isAccessible = true }.get(i1) as Ref.IntRef
        val f2 = i2.javaClass.getDeclaredField("\$i2").apply { isAccessible = true }.get(i2) as Ref.IntRef
        val temp = f1.element
        f1.element = f2.element
        f2.element = temp
    }

    @Test @Ignore
    fun swapTest() {
        var i1 = 1
        var i2 = 2
        some({ i1 }, { i2 })
        assertEquals(2, i1)
        assertEquals(1, i2)
    }
}